feat(integrations): unify Tau memory schemas and setup - #1493
Conversation
Signed-off-by: phernandez <paul@basicmachines.co>
Signed-off-by: phernandez <paul@basicmachines.co>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Manual acceptance test planTester: Paul. Status: not yet run. Automated results above do not substitute for this live-model/interactive pass. Record pass/fail and the returned note paths below. Use non-sensitive test content and a disposable local Basic Memory project. Model synthesis incurs normal provider charges. Do not use a team/production destination for this pass. 1. Launch safely from the branchUse the existing checkout below, or substitute your checkout of export BM_SRC=/Users/phernandez/dev/basicmachines/basic-memory-tau-1487
# Confirm feat/tau-shared-memory and the current PR head before testing.
git -C "$BM_SRC" branch --show-current
git -C "$BM_SRC" rev-parse HEAD
uv sync --project "$BM_SRC/integrations/tau"
export BM_TEST_ROOT="$(mktemp -d)"
export TAU_BASIC_MEMORY_CONFIG="$BM_TEST_ROOT/basic-memory.json"
cat > "$TAU_BASIC_MEMORY_CONFIG" <<'JSON'
{
"project": null,
"auto_recall": false,
"capture_knowledge": false,
"checkpoint_on_compact": false,
"summarize_on_shutdown": false,
"capture_transcript": false
}
JSON
chmod 600 "$TAU_BASIC_MEMORY_CONFIG"
mkdir "$BM_TEST_ROOT/repo"
git -C "$BM_TEST_ROOT/repo" init -b main
git -C "$BM_TEST_ROOT/repo" -c user.name='BM Test' \
-c user.email='bm-test@example.invalid' -c commit.gpgsign=false \
commit --allow-empty -m 'Initialize disposable memory test'
cd "$BM_TEST_ROOT/repo"
uv run --project "$BM_SRC/integrations/tau" tau -e "$BM_SRC/integrations/tau"The launch uses the pinned organization fork while preserving the test repo as cwd. Do not launch from the BM source directory when testing this repo's profile. Keep the same shell exports for subsequent launches. The separate config does not isolate provider credentials or Tau's normal session storage; use test conversations only. Do not load a second installed copy of the BM extension.
2. Test the setup interviewThe skill need not be installed globally. In Tau, ask it to read the absolute file path shown by
Suggested prompt:
Choose an existing disposable local BM project, or explicitly approve creating one as a separate step. For the test-only repository label, confirm
3. Verify structured knowledge, not just a saved summarySend a small test task:
Wait for the turn to settle, then inspect the confirmed checkpoint using BM tools or your note viewer.
4. Reload, checkpoints, compaction, and shutdown
5. Cross-worktree and repository isolationExit the test Tau session normally first. From the same shell: git -C "$BM_TEST_ROOT/repo" worktree add -b second-checkout "$BM_TEST_ROOT/worktree"With approval, add a second repository entry to the test config, copying the explicitly approved project/read-source/placement choices, using root
6. Optional read-only source and general-profile checks
7. Finish and reportQuit test sessions normally before changing destinations or disabling capture: the old lifecycle can still write during shutdown/reload using its previous settings. Do not delete a worktree while its Tau session is running.
Manual result: pending tester execution. |
Signed-off-by: phernandez <paul@basicmachines.co>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dfbff24f1e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| prior = checkpoint_records[-1] if checkpoint_records else None | ||
| tip = entries[-1].id | ||
| capture_id = digest([self.settings.project, context.session_id, "checkpoint", tip]) | ||
| capture_id = digest([self.profile.project, context.session_id, "checkpoint", tip]) |
There was a problem hiding this comment.
Scope capture identities to the repository
When a persisted Tau session is resumed in another configured repository that writes to the same Basic Memory project, both context.session_id and the source entry ID remain unchanged, so this hash collides with the prior repository's capture. The subsequent prior/recover paths can then return that old checkpoint as confirmed without validating its repository, leaving the current repository without a checkpoint and potentially pointing compaction at unrelated work. Include the coding profile's repository identity in checkpoint and transcript capture IDs, and apply the same scope when recovering captures.
Useful? React with 👍 / 👎.
Why
Follow-up to #1489; refs #1487. Basic Memory's value is shared, structured knowledge that any connected agent can find and understand. Tau's initial integration delivered lifecycle continuity but emitted
coding_sessionnotes without the established Git identity fields and used cwd-only recall. Setup also needed schema/placement conventions and a packaged installation path that does not require a source checkout.This aligns the memory contract without invoking
bm hookfrom Tau, importing CLI orchestration into the extension, or introducing a generic host framework. Sidebar/custom-frontend work remains separate.What Changed
integrations/shared/schemas, with checked copies in Claude Code, Codex, and Tau packages. New checkpoints use the sharedagent/session_idpair. Existing agent-specific identity fields remain accepted for old notes; Codex keeps its separate general-session schema.{chosen project}/tau/{repo name}, using stable repository identity rather than the worktree basename. General sessions retaintau/checkpoints; transcripts retaintau/transcripts; explicit folder overrides win.session. Synthesis uses shared schema categories.bm install tau --dry-runandbm install tau --sync: packaged extension, setup/shared skills, and four prompt templates. The installer previews and confirms changes, preserves existing configuration/credentials, reuses shared resources, refuses conflicting copies and unapproved replacements, and optionally syncs an isolated pinned Tau environment./bm-resume,/bm-plan,/bm-decide, and/bm-wrap-uptemplates.d8216af0b34059839734422d1e39b4c5972d7966, including the single-copy snapshot fix. Upstream contribution: feat: support awaited extension continuity across compaction huggingface/tau#687.Implementation Details
knowledge.pyowns validated profiles, bounded asynchronous Git metadata reads, and session placement. Coding placement takes the final component of the user-confirmed repository identity; multiple explicitly registered worktrees therefore share a folder. An omitted/nullcheckpoint_folderselects automatic placement. Existing string overrides remain authoritative, includingtau/checkpoints.The lifecycle stays in
continuity.py; MCP ownership, argument forwarding, and receipt identity retain their existing boundaries. Missing/failed/timed-out optional GitHub lookup omits PR context; invalid successful payloads and required Git failures surface rather than inventing identity. Secondary projects participate only in automatic reads. Explicit agent tool arguments remain unchanged.Hook-backed Claude Code/Codex writers and deliberate checkpoint skills now emit the shared identity pair as well. Legacy note fields remain readable, and same-chat lineage must match host plus session ID rather than a bare ID.
The wheel explicitly includes Tau resources, excluding integration environments/caches. Installation locates distribution-owned resources (including editable-install resource behavior), bypasses normal CLI initialization, and does not read/change user config, initialize the database, or write notes.
--syncis separate opt-in dependency installation; it does not change global Tau. Launch withuv run --project ~/.tau/extensions/basic-memory tauwithout a second explicit-eload.Canonical schemas are bundled as self-contained copies checked by
scripts/sync_memory_schemas.py --check. Existing user schemas, notes, and durable receipts are not rewritten automatically.Testing
Latest local verification before pushing:
just fast-check: passed, including root Ruff, format, andjust typecheck.uv run pytest tests/cli/test_install_tau.py tests/cli/test_install_tau_wheel.py tests/cli/test_coding_session_context.py tests/cli/test_hook_command.py tests/test_codex_plugin_package.py -q: 159 passed, 1 opt-in wheel test skipped.just package-check: passed across all packages. Tau: 76 passed, 4 opt-in real-BM tests skipped, Ruff/format/ty passed.BM_TAU_TEST_COMMAND="$PWD/.venv/bin/bm" uv run --project integrations/tau --with pytest-cov pytest -c integrations/tau/pyproject.toml integrations/tau/tests --cov=tau --cov-config=integrations/tau/pyproject.toml --cov-report=term-missing -q: 80 passed; 100% statement coverage across six Tau runtime modules (623 statements). An initial invocation without Tau-local coverage configuration failed before collection because the root coverage configuration requires gevent; the corrected command above passed.uv build --wheel --out-dir /tmp/tau-pr-wheel, followed byBM_TAU_INSTALL_WHEEL=<built-wheel> uv run pytest tests/cli/test_install_tau_wheel.py --no-cov -q: 1 passed. Exercises preview, installation, and repeat installation from an extracted wheel outside the checkout, without creating config/database state.just doctor: passed in a temporary project.git diff --check: passed.Tests cover coding/general default placement, explicit overrides and configuration round trips, actual checkpoint write destinations, Git/PR metadata and cancellation, nested/unborn checkout safety, read-only source routing, real Tau resource loading/expansion, installer approval/conflict behavior, and schema parity. Real-BM tests validate Tau checkpoints and cross-worktree recall of both shared-identity and legacy other-host notes. Existing compaction/reload/branch/resume, TUI reload, receipt reconciliation, privacy, and persistent MCP tests pass.
The user reports the pinned installed launch works. Automated model synthesis uses deterministic fake providers; no paid live-model, production-memory, or cloud-account test was performed by the assistant for this update. Full SQLite/Postgres suites were not rerun.
Risks / Follow-ups
No merge is authorized.